package cn.itsource.pethome.controller;

import cn.itsource.pethome.domain.Shop;
import cn.itsource.pethome.query.ShopQuery;
import cn.itsource.pethome.result.JSONResult;
import cn.itsource.pethome.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/shop")
@RestController
public class ShopController {
    @Autowired
    private ShopService shopService;
   @PostMapping("/settlement")
    public JSONResult registerShop(@RequestBody Shop shop){
       JSONResult settlement = shopService.settlement(shop);
       return JSONResult.success(settlement);
    }
    @GetMapping("/list")
    public JSONResult list(){
        List<Shop> shopList = shopService.list();
        return JSONResult.success(shopList);
    }
    @PostMapping("/pagelist")
    public JSONResult pagelist(@RequestBody ShopQuery shopQuery){
        JSONResult pagelist = shopService.pagelist(shopQuery);
        return pagelist;
    }
    @GetMapping("/auditYes/{shopId}")
    public JSONResult auditYes(@PathVariable("shopId") Long shopId){
       return shopService.auditYes(shopId);
    }
    @GetMapping("/jihuo/{shopId}")
    public JSONResult jihuo(@PathVariable("shopId") Long shopId){
        return shopService.jihuo(shopId);
    }
}
